<?php
class ArticleAction extends Action{
   public function _initialize(){
	  R("Home.Public","top");
	  R("Home.Public","bottom");   
   }
   public function index(){
	  import("ORG.Com.DiyCache");
	  $mycache=new DiyCache;
	  if(!$mycache->is_cached()){//处理自定义缓存
	     /*安全处理及获取参数*/
		 checkget();
		 checkpost();
		 $typeid = $_GET['typeid'];
		 if(empty($typeid)||!is_numeric($typeid))alert('参数错误');
		 /*安全处理及获取参数*/
		 switch($typeid){
			case 75://企业介绍
			  $tpl_name = "about";
			  $column_name = gettypenamebytypeid(75);
			break; 
			case 79://品牌个性
			  $tpl_name = "personality";
			  $column_name = gettypenamebytypeid(79);
			break;
			case 78://品牌核心
			  $tpl_name = "core";
			  $column_name = gettypenamebytypeid(78);
			break;
			case 77://品牌源起与定位
			  $tpl_name = "source";
			  $column_name = gettypenamebytypeid(77);
			break;
			
			case 83://服务体系
			  $tpl_name = "service";
			  $column_name = gettypenamebytypeid(83);
			break;
			
			case 82://作业流程
			  $tpl_name = "process";
			  $column_name = gettypenamebytypeid(82);
			break;
			
			case 81://小贴士
			  $tpl_name = "tip";
			  $column_name = gettypenamebytypeid(81);
			break;
			
			case 85://安泊实力
			  $tpl_name = "strength";
			  $column_name = gettypenamebytypeid(85);
			break;
			
			case 86://加盟条件
			  $tpl_name = "conditions";
			  $column_name = gettypenamebytypeid(86);
			break;
			
			case 87://加盟流程
			  $tpl_name = "joinprocess";
			  $column_name = gettypenamebytypeid(87);
			break;
			
			case 88://加盟支持
			  $tpl_name = "support";
			  $column_name = gettypenamebytypeid(88);
			break;
			
			case 90://加盟申请表
			  $tpl_name = "table";
			  $column_name = gettypenamebytypeid(90);
			break;
		 }
		 $this->assign("column_name",$column_name);	 
		 
	     $article = M("article");
		 
		 $a_info = $article->where("typeid = $typeid")->find();
		 $this->assign("a_info",$a_info);
		
		 if(C("diy_cache"))$mycache->create_cache($this->fetch($tpl_name));//创建缓存
		 $this->display($tpl_name);
	  }
   }
   public function system(){//五大系统
   	  import("ORG.Com.DiyCache");
	  $mycache=new DiyCache;
	  if(!$mycache->is_cached()){//处理自定义缓存
		 /*安全处理及获取参数*/
		 checkget();
		 $id = $_GET['id'];
		 /*安全处理及获取参数*/
	  
	     $column_name = "五大系统";
		 $this->assign("column_name",$column_name);
		 
	     $typeid = 92;
		 
		 $article = M("article");
		 $a_list = $article->where("typeid = $typeid")->order("sequence desc")->field("id,title")->findAll();
		 $this->assign("a_list",$a_list);
		 if(empty($id)) $id = $a_list[0]['id'];
		 
		 $this->assign("id",$id);
		 
		 $content = $article->where("id = $id")->getField("content");
		 
		 $this->assign("content",$content);
		 
	  	 if(C("diy_cache"))$mycache->create_cache($this->fetch());//创建缓存
		 $this->display();
	  }
   }
}
?>